package com.hundsun.cprs.yyt.service.match.dto;

import java.util.Date;

public class EntrustRequest extends BaseDTO {

	private static final long serialVersionUID = -2342741292416409553L;

	public static final String EntrustBuy = "1";// 买入

	public static final String EntrustSell = "2";// 卖出

	public static final String EntrustPropNormal = "0";// 普通买入卖出

	public static final String EntrustPropOwnSideBest = "S";// 本方最优委托

	public static final String EntrustPropOppositeBest = "Q";// 对方最优委托

	public static final String EntrustPropBestFiveLastPaste = "R";// 最优五档即时成交剩余转限价

	public static final String EntrustPropBestFiveLastCancel = "U";// 最优五档即时成交剩余撤销
	/**挂牌业务*/
	public static final String EntrustPropListingEntrust = "L";// 挂牌业务
	/**摘牌业务*/
	public static final String EntrustPropDeListingEntrust = "D";// 摘牌业务
	/**系统自动挂牌业务*/
	public static final String EntrustPropAUTODeListingEntrust = "A";// 挂牌业务
	/**系统强制挂牌业务（6个交易日强制卖出）*/
	public static final String EntrustPropAUTOListEntrust = "B";// 挂牌业务
	
	private Long id;//委托单ID

	private String fundAccount;// 资金帐号

	private String stockAccount;// 交易帐号

	private String stockCode;// 合约代码

	private Long entrustAmount;// 委托数量

	private Long entrustPrice;// 委托价格,以分为单位

	private String entrustProp = EntrustPropNormal;// 委托属性

	private String entrustBS;// 买卖方向

	private Date entrustTime;// 委托时间
	
	private Long entrustNo; // 委托编号
	
	private String locale;//国际化语言
	
	private String userName; // 交易商姓名
	
	/**
	 * 是否委买
	 * 
	 * @return
	 */
	public boolean isBuy() {
		return this.entrustBS != null && this.entrustBS.equals(EntrustBuy);
	}

	/**
	 * 是否委卖
	 * 
	 * @return
	 */
	public boolean isSell() {
		return this.entrustBS != null && this.entrustBS.equals(EntrustSell);
	}

	/**
	 * 是否普通买入卖出
	 * 
	 * @return
	 */
	public boolean isPropNormal() {
		return this.entrustProp != null
				&& (this.entrustProp.equalsIgnoreCase(EntrustPropNormal) ||
						this.entrustProp.equalsIgnoreCase(EntrustPropAUTODeListingEntrust) ||
						this.entrustProp.equalsIgnoreCase(EntrustPropAUTOListEntrust));
	}

	/**
	 * 是否本方最优委托
	 * 
	 * @return
	 */
	public boolean isPropOwnSideBest() {
		return this.entrustProp != null
				&& this.entrustProp.equalsIgnoreCase(EntrustPropOwnSideBest);
	}

	/**
	 * 是否对方最优委托
	 * 
	 * @return
	 */
	public boolean isPropOppositeBest() {
		return this.entrustProp != null
				&& this.entrustProp.equalsIgnoreCase(EntrustPropOppositeBest);
	}

	/**
	 * 是否最优五档即时成交剩余转限价
	 * 
	 * @return
	 */
	public boolean isPropBestFiveLastPaste() {
		return this.entrustProp != null
				&& this.entrustProp
						.equalsIgnoreCase(EntrustPropBestFiveLastPaste);
	}

	/**
	 * 是否最优五档即时成交剩余撤销
	 * 
	 * @return
	 */
	public boolean isPropBestFiveLastCancel() {
		return this.entrustProp != null
				&& this.entrustProp
						.equalsIgnoreCase(EntrustPropBestFiveLastCancel);
	}

	/**
	 * 不成交是否需要撤单
	 * 
	 * @return
	 */
	public boolean isLastEntrustCancel() {
		return isPropBestFiveLastCancel();// 目前只有最优五档即时成交剩余撤销是不成交则撤单
	}
	
	/**
	 * 不成交是否需要挂单
	 * @return
	 */
	public boolean isLastEntrustPaste(){
		return !isLastEntrustCancel();
	}
	
	public boolean isListingEntrust(){
		return this.entrustProp != null
				&& this.entrustProp
				.equalsIgnoreCase(EntrustPropListingEntrust);
	}

	public boolean isDeListingEntrust(){
		return this.entrustProp != null
				&& this.entrustProp
				.equalsIgnoreCase(EntrustPropDeListingEntrust);
	}
	
	/**
	 * 是否为挂牌交易模式
	 * @return
	 */
	public boolean isListedTradingMode(){
		return isListingEntrust() || isDeListingEntrust();
	}
	
	public String getFundAccount() {
		return fundAccount;
	}

	public void setFundAccount(String fundAccount) {
		this.fundAccount = fundAccount;
	}

	public String getStockAccount() {
		return stockAccount;
	}

	public void setStockAccount(String stockAccount) {
		this.stockAccount = stockAccount;
	}

	public String getStockCode() {
		return stockCode;
	}

	public void setStockCode(String stockCode) {
		this.stockCode = stockCode;
	}

	public Long getEntrustAmount() {
		return entrustAmount;
	}

	public void setEntrustAmount(Long entrustAmount) {
		this.entrustAmount = entrustAmount;
	}

	public Long getEntrustPrice() {
		return entrustPrice;
	}

	public void setEntrustPrice(Long entrustPrice) {
		this.entrustPrice = entrustPrice;
	}

	public String getEntrustProp() {
		return entrustProp;
	}

	public void setEntrustProp(String entrustProp) {
		this.entrustProp = entrustProp;
	}

	public String getEntrustBS() {
		return entrustBS;
	}

	public void setEntrustBS(String entrustBS) {
		this.entrustBS = entrustBS;
	}

	public Date getEntrustTime() {
		return entrustTime;
	}

	public void setEntrustTime(Date entrustTime) {
		this.entrustTime = entrustTime;
	}

	public Long getEntrustNo() {
		return entrustNo;
	}

	public void setEntrustNo(Long entrustNo) {
		this.entrustNo = entrustNo;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

    public String getLocale() {
        return locale;
    }

    public void setLocale(String locale) {
        this.locale = locale;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
}
